<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>抽奖</title>
    </head>
    <body>
        <h1 id="txt">开始抽奖吧</h1>
        <button id="start">开始</button>
        <button id="end">结束</button>
        <script>
            var t=txt.value
            var s=start.value
            var e=end.value
            var user=['张三','李四','卢本伟','boy','girl']
            var timer;
            start.onclick=function(){
                clearInterval(timer)
                timer=setInterval(function(){
                    var n=parseInt(Math.random()*user.length);
                    txt.innerHTML=user[n];
                },100)
            }
            end.onclick=function(){
                clearInterval(timer)
            }
        </script>
        
    </body>
</html>